package com.tiantianyuegou.adapter;


import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.trouble.framework.adapter.BaseAdapterHelper;
import com.trouble.framework.adapter.QuickAdapter;
import com.tiantianyuegou.R;
import com.tiantianyuegou.model.AreaModel;

import java.util.List;

/**
 * Created by ivany on 2016/1/14.
 */
public class AreaAdapter extends QuickAdapter<AreaModel> {

    public AreaAdapter(Context context) {
        super(context, R.layout.item_select_area);
    }

    public void setData(List<AreaModel> datas) {
        data.clear();
        data.addAll(datas);
    }

    @Override
    protected void convert(BaseAdapterHelper baseAdapterHelper, AreaModel areaModel) {
        TextView areaName = baseAdapterHelper.getView(R.id.item_select_area_txt);
        ImageView imageView=baseAdapterHelper.getView(R.id.item_select_area_arraw);
        if("3".equals(areaModel.getLevel())){
            imageView.setVisibility(View.GONE);
        }else{
            imageView.setVisibility(View.VISIBLE);
        }
        areaName.setText(areaModel.getName());
    }
}
